#include "SFData.h"

BYTE ubSFLib_CmdID = 0;
BYTE sfManufactureID = 0;
BYTE sfDeviceID1 = 0;
BYTE sfDeviceID2 = 0;

BYTE cbSFLib_Cmd[][7] = {
	//READ			  WREN			  PP				 WRSR			 CE				SE				WRDI
	{ SFCMD_READ_MXIC, SFCMD_WRDI_MXIC, SFCMD_READ_MXIC, SFCMD_RDSR_MXIC, SFCMD_READ_MXIC, SFCMD_READ_MXIC, SFCMD_WRDI_MXIC },	// 0x00
	{ SFCMD_READ_MXIC, SFCMD_WREN_MXIC, SFCMD_PP_MXIC, SFCMD_WRSR_MXIC, SFCMD_CE_MXIC, SFCMD_SE_MXIC, SFCMD_WRDI_MXIC },	// 0x01
	{ SFCMD_READ_AT25FS, SFCMD_WREN_AT25FS, SFCMD_PP_AT25FS, SFCMD_WRSR_AT25FS, SFCMD_CE_AT25FS, SFCMD_SE_AT25FS, SFCMD_WRDI_AT25FS },	// 0x02
	{ SFCMD_READ_PMC, SFCMD_WREN_PMC, SFCMD_PP_PMC, SFCMD_WRSR_PMC, SFCMD_CE_PMC, SFCMD_SE_PMC, SFCMD_WRDI_PMC },	// 0x03
	{ SFCMD_READ_SST, SFCMD_WREN_SST, SFCMD_AAIP_SST, SFCMD_WRSR_SST, SFCMD_CE_SST, SFCMD_SE_SST, SFCMD_WRDI_SST },	// 0x04
};


BYTE cbSFLib_ID[][6] = {
	{ SF_UNKNOW, 0x00, 0x00, SF_UNKNOW, 0x00, SF_OPT_NA },

	{ SF_MFRID_MXIC, 0x20, 0x10, SF_MXIC, 0x01, SF_OPT_SE },				// MXIC MX25L512AMC 
	{ SF_MFRID_MXIC, 0x22, 0x10, SF_MXIC, 0x01, SF_OPT_SE },				//MX25L5121E 
	{ SF_MFRID_MXIC, 0x20, 0x13, SF_MXIC, 0x01, SF_OPT_SE },				// KH25L4006E

	{ SF_MFRID_ATMEL, 0x65, 0x01, SF_ATMEL_AT25F, 0x02, SF_OPT_SE },		// Atmel AT25F512B

	{ SF_MFRID_PMC, 0x20, 0xFF, SF_PMC, 0x03, SF_OPT_SE },				// PMC Pm25LD512
	{ SF_MFRID_PMC, 0x7B, 0xFF, SF_PMC, 0x03, SF_OPT_SE },				// PMC Pm25LV512
	{ SF_MFRID_PMC, 0x10, 0xFF, SF_PMC, 0x03, SF_OPT_SE },

	{ SF_MFRID_SST, 0x48, 0xFF, SF_SST, 0x04, SF_OPT_SE },				// SST 25VF512
	{ SF_MFRID_ST, 0x20, 0x11, SF_ST, 0x01, SF_OPT_SE },

	{ SF_MFRID_ESMT, 0x30, 0x10, SF_ESMT, 0x01, SF_OPT_SE },				// F25L05PA

	{ SF_MFRID_GIGA, 0x40, 0x10, SF_GIGA, 0x01, SF_OPT_SE },				// GD25Q512
	{ SF_MFRID_GIGA, 0x40, 0x13, SF_GIGA, 0x01, SF_OPT_SE },				//MK25D40

	{ SF_MFRID_WINBOND, 0x30, 0x10, SF_WINBOND, 0x01, SF_OPT_SE },		//W25X05CL
	{ SF_MFRID_WINBOND, 0x30, 0x11, SF_WINBOND, 0x01, SF_OPT_SE },

	//special
	{ SF_MFRID_FENTECH, 0x60, 0x13, SF_FENTECH, 0x01, SF_OPT_SE },				//FH25VQ40
	{ SF_MFRID_FENTECH, 0x60, 0x12, SF_FENTECH, 0x01, SF_OPT_SE },				//FH25VQ20

	{ SF_MFRID_MXIC, 0x20, 0x11, SF_MXIC, 0x01, SF_OPT_SE },				// MX25L1006E 

};

LONG ubSFLib_GetIDSize()
{
	return sizeof(cbSFLib_ID) / 6;
}

